<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-form [formGroup]="formGroup" [lvLabelColon]="false" class="formGroup" lvKeepRequiredWidth>
    <lv-form-item>
        <lv-form-label>
            {{ copyNameLable }}
        </lv-form-label>
        <lv-form-control [lvErrorTip]="nameErrorTip">
            <input lv-input formControlName="copy_name" />
        </lv-form-control>
    </lv-form-item>
    <lv-form-item>
        <lv-form-label>
            {{ 'explore_snapshot_retention_policy_label' | i18n }}
            <i lv-icon="aui-icon-help" lv-tooltip="{{'explore_snapshot_retention_help_label' | i18n}}"
                lvTooltipPosition="rightTop" lvTooltipTheme="light" class="configform-constraint"
                lvColorState='true'></i>
        </lv-form-label>
        <lv-form-control>
            <lv-input-group [lvAddAfter]="unitTpl" class="aui-select-right">
                <input lv-input formControlName="retention_duration" type="text"
                       placeholder="{{formGroup.value.duration_unit=='d'?'1~365':formGroup.value.duration_unit=='w'?'1~54':formGroup.value.duration_unit=='MO'?'1~24':formGroup.value.duration_unit=='p' ? '':'1~10'}}"
                       class="retention" />
            </lv-input-group>
            <ng-template #unitTpl>
                <lv-select [lvOptions]="durationUnitOptions" formControlName="duration_unit" lvValueKey="value"
                           class="aui-inner-select">
                </lv-select>
            </ng-template>
        </lv-form-control>
    </lv-form-item>
    <lv-form-item *ngIf="isOceanProtect">
        <lv-form-label>
            {{ 'explore_depth_detection_label' | i18n }}
        </lv-form-label>
        <lv-form-control>
            <lv-switch formControlName="is_backup_detect_enable"></lv-switch>
            <ng-container *ngIf="formGroup.value.is_backup_detect_enable">
                <span class="aui-text-help-sm">
                    {{'explore_backup_policy_backup_detect_label' | i18n}}
                </span>
                <!-- 敏感度调节 -->
                <aui-detect-upper-bound [formGroup]="formGroup"></aui-detect-upper-bound>
            </ng-container>
        </lv-form-control>
    </lv-form-item>
    <lv-form-item>
        <lv-form-label>
            {{ 'protection_lock_no_anti_data_label' | i18n }}
            <i lv-icon="aui-icon-help" lv-tooltip="{{'protection_anti_lock_enable_tip_label' | i18n}}"
                lvTooltipPosition="rightTop" lvTooltipTheme="light" class="configform-constraint"
                lvColorState='true'></i>
        </lv-form-label>
        <lv-form-control>
            <lv-group lvGutter="4px" class="switch-group">
                <lv-switch formControlName="is_security_snap" class="switch-group-item"></lv-switch>
                <ng-container *ngIf="formGroup.value.is_security_snap">
                    <span class="aui-text-help-sm">
                        {{'protection_anti_lock_enable_tip_label' | i18n}}
                    </span>
                </ng-container>
            </lv-group>
        </lv-form-control>
    </lv-form-item>
</lv-form>
